﻿<Window x:Class="PaiPaiImage.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="拍拍详细图片处理工具" Height="500" Width="900" Drop="Window_Drop" AllowDrop="True" Loaded="Window_Loaded" WindowStartupLocation="CenterScreen" KeyUp="Window_KeyUp">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="*" MinHeight="100"/>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*" MinHeight="100"/>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="Auto"/>
        </Grid.RowDefinitions>
        <GroupBox Grid.Row="0" Header="要处理的文件列表-请拖放文件到此处" Margin="3">
            <DataGrid Name="dgFiles" RowHeaderWidth="20" AutoGenerateColumns="False" SelectionMode="Extended" SelectionUnit="CellOrRowHeader">
                <DataGrid.RowStyle >
                    <Style TargetType="{x:Type DataGridRow}">
                        <Setter Property="Background" Value="{Binding Path=Background}">
                        </Setter>
                    </Style>
                </DataGrid.RowStyle>

                <DataGrid.Columns>
                    <DataGridTextColumn Header="文件路径" Width="*" IsReadOnly="True" Binding="{Binding Path=Path}"/>
                    <DataGridTextColumn Header="像素信息" Width="100" IsReadOnly="True" Binding="{Binding Path=PixelSize}"/>
                    <DataGridTextColumn Header="文件大小(KB)" Width="100" IsReadOnly="True" Binding="{Binding Path=SizeInKB}"/>
                    <DataGridTextColumn Header="处理状态" Width="100" IsReadOnly="True" Binding="{Binding Path=State}"/>
                    <DataGridHyperlinkColumn Header="删除" Width="Auto" Binding="{Binding Path=Action}">
                        <DataGridHyperlinkColumn.ElementStyle>
                            <Style>
                                <EventSetter Event="Hyperlink.Click" Handler="Button_Click"/>
                            </Style>
                        </DataGridHyperlinkColumn.ElementStyle>
                    </DataGridHyperlinkColumn>
                </DataGrid.Columns>
            </DataGrid>
        </GroupBox>
        <GridSplitter Grid.Row="1" Height="5" Background="Blue" VerticalAlignment="Center" HorizontalAlignment="Stretch"/>
        <GroupBox Grid.Row="2" Header="处理后生成的文件" Margin="3">
            <DataGrid  Name="dgNewFiles" RowHeaderWidth="20" AutoGenerateColumns="False" SelectionMode="Extended" SelectionUnit="CellOrRowHeader">
                <DataGrid.RowStyle >
                    <Style TargetType="{x:Type DataGridRow}">
                        <Setter Property="Background" Value="{Binding Path=Background}">
                        </Setter>
                    </Style>
                </DataGrid.RowStyle>
                <DataGrid.Columns>
                    <DataGridTextColumn Header="文件路径" Width="*" IsReadOnly="True" Binding="{Binding Path=Path}"/>
                    <DataGridTextColumn Header="像素信息" Width="100" IsReadOnly="True" Binding="{Binding Path=PixelSize}"/>
                    <DataGridTextColumn Header="文件大小(KB)" Width="100" IsReadOnly="True" Binding="{Binding Path=SizeInKB}"/>
                    <DataGridTextColumn Header="处理状态" Width="100" IsReadOnly="True" Binding="{Binding Path=State}"/>
                    <DataGridHyperlinkColumn Header="删除" Width="Auto" Binding="{Binding Path=Action}">
                    </DataGridHyperlinkColumn>
                </DataGrid.Columns>
            </DataGrid>
        </GroupBox>
        <StackPanel Grid.Row="3"  Orientation="Horizontal" HorizontalAlignment="Right">
            <CheckBox Content="根据文件顺序自动重新命名" Margin="3" VerticalAlignment="Center" Name="chkAutoRename" IsChecked="True"/>
            <TextBlock Text="新图片宽度:" Margin="3" VerticalAlignment="Center"/>
            <TextBox Name="tbNewWidth" Margin="3" VerticalAlignment="Center" Text="730" Width="40"/>
            <CheckBox Name="cbSmallNoResize" Content="宽度小时不放大" IsChecked="True" VerticalAlignment="Center" Margin="3"/>
            <CheckBox Name="cbSpilt" Content="分割图片" Margin="30,3,3,3" VerticalAlignment="Center" IsChecked="True"/>
            <TextBlock Text="图片大小上限(KB):" Margin="3" VerticalAlignment="Center"/>
            <TextBox Name="tbSizeInKB" Margin="3" VerticalAlignment="Center" Text="1024" Width="40" IsEnabled="{Binding ElementName=cbSpilt, Path=IsChecked}" />
            <TextBlock Text="输出路径:" Margin="3" VerticalAlignment="Center"/>
            <ComboBox Margin="3" Name="cbbOutput" VerticalAlignment="Center" Width="100" IsEditable="True">
                <ComboBoxItem>详细图</ComboBoxItem>
                <ComboBoxItem>首图</ComboBoxItem>
                <ComboBox.SelectedIndex>0</ComboBox.SelectedIndex>
            </ComboBox>
        </StackPanel>

        <Grid Grid.Row="5" Margin="4">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="*"/>
                <ColumnDefinition Width="Auto"/>
                <ColumnDefinition Width="Auto"/>
                <ColumnDefinition Width="Auto"/>
            </Grid.ColumnDefinitions>
            <TextBlock Grid.Column="0" Name="tbProcess" Margin="3" FontSize="16" Foreground="Red" VerticalAlignment="Center" HorizontalAlignment="Center"/>
            <Button Grid.Column="2" Name="btnClear" Content="清空" Margin="3" Width="60" Click="btnClear_Click"/>
            <Button Grid.Column="3" Name="btnProcess" Margin="3" Content="处理" Width="60" Click="btnProcess_Click" />
        </Grid>
    </Grid>
</Window>
